import request from '@/router/axios';

export const getList = (current, size, rpiKind, params) => {
  return request({
    url: '/api/rb-service/service/posinfo/pos_info/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
      rpiKind,
    }
  })
}

export const getMerchantList = (current, size, rpiKind, params) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
      rpiKind,
    }
  })
}

export const getDetail = (rpiNo) => {
  return request({
    // url: '/api/rb-service/service/posinfo/pos_info/detail',
    url: '/api/rb-service/service/posinfo/pos_info/groupRpiDetail',
    method: 'get',
    params: {
      rpiNo
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/rb-service/service/posinfo/pos_info/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/rb-service/service/posinfo/pos_info/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/rb-service/service/posinfo/pos_info/submit',
    method: 'post',
    data: row
  })
}

/* merchant商户 禁用启用 */
export const onOrOffPosInfo = (id, rpiStatus) => {
  return request({
    url: '/api/rb-service/service/posinfo/pos_info/onOrOffPosInfo',
    method: 'post',
    params: {
      id,
      rpiStatus
    }
  })
}

/* 集团商户 增/改 */
export const addGroup = (row) => {
  return request({
    url: '/api/rb-service/service/posinfo/pos_info/insertGroupRpi',
    method: 'post',
    data: row
  })
}

export const updateGroup = (row) => {
  return request({
    url: '/api/rb-service/service/posinfo/pos_info/insertGroupRpi',
    method: 'post',
    data: row
  })
}

/* 集团商户 审核状态 已完成 拉取流接口 */
export const updateGroupPlus = (row) => {
  return request({
    url: '/api/rb-service/service/posinfo/pos_info/insertGroupRpiPlus',
    method: 'post',
    data: row
  })
}

/* MCC行业分类 现代版本 */
export const getMccIndustryList = (userType, ysMerchantKey) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/selectIndustry',
    method: 'get',
    params: {
      userType,
      ysMerchantKey
    }
  })
}

/* MCC行业分类 */
// export const getMccIndustryList = (userType, industryCode, industryName) => {
//   return request({
//     url: '/api/rb-service/service/mcc/mcc/selectIndustry',
//     method: 'get',
//     params: {
//       userType,
//       industryCode,
//       industryName,
//     }
//   })
// }

export const getMccList = (current, size, industryCode, mccNo) => {
  return request({
    url: '/api/rb-service/service/mcc/mcc/selectMcc',
    method: 'get',
    params: {
      current,
      size,
      industryCode,
      mccNo
    }
  })
}

/* 查询第一级银行编号 */
export const getFirstBankList = (current, size, params) => {
  return request({
    url: '/api/rb-service/service/bankType/bank_type/FirstBankList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

/* 查询第二级银行编号 */
export const getSecondBankList = (current, size, cityCode, bankType) => {
  return request({
    url: '/api/rb-service/service/bankType/bank_type/SecondBankList',
    method: 'get',
    params: {
      current,
      size,
      cityCode,
      bankType
    }
  })
}

/* 获取客户经理列表 */
export const getAccountManagerList = (params) => {
  return request({
    url: '/api/rb-service/service/posinfo/pos_info/accountManagerList',
    method: 'get',
    params: {
      ...params
    }
  })
}

/* 结算类型列表 */
export const getBalanceAccTypeList = (userType) => {
  return request({
    url: '/api/rb-service/service/posinfo/pos_info/queryBalanceAccTypeVO',
    method: 'get',
    params: {
      userType
    }
  })
}

/* 集团商户编辑 */
export const updateGroupDetail = (row) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/updateGroupDetail',
    method: 'post',
    data: row
  })
}

/* 商户进件 基本信息 */
export const addFirstStep = (row) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/firstStep',
    method: 'post',
    data: row
  })
}

export const updateFirstStep = (row) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/firstStep',
    method: 'post',
    data: row
  })
}

/* 商户进件 结算账户信息 */
export const addSecondStep = (row) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/secondStep',
    method: 'post',
    data: row
  })
}

export const updateSecondStep = (row) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/secondStep',
    method: 'post',
    data: row
  })
}

/* 商户进件 费率信息 */
export const addThirdStep = (row) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/thirdStepV2',
    method: 'post',
    data: row
  })
}

export const updateThirdStep = (row) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/thirdStepV2',
    method: 'post',
    data: row
  })
}

/* 商户进件 协议信息 */
export const addFourthStep = (row) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/fourthStepV2',
    method: 'post',
    data: row
  })
}

export const updateFourthStep = (row) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/fourthStepV2',
    method: 'post',
    data: row
  })
}

/* 商户进件 第二步暂存 */
export const saveStepSto = (row) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/secondStepSto',
    method: 'post',
    data: row
  })
}

export const getFirstStepVO = (id) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/firstStepVO',
    method: 'get',
    params: {
      id
    }
  })
}

export const getSecondStepVO = (id) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/secondStepVO',
    method: 'get',
    params: {
      id
    }
  })
}

export const getThirdStepVO = (params) => {
  return request({
    // url: '/api/rb-service/service/incomingbasic/incoming_basic/thirdStepVO',
    url: '/api/rb-service/service/incomingbasic/incoming_basic/thirdStepVOV2',
    method: 'get',
    params
  })
}

/**
 * @DESC 第四步详情
 */
export const getFourthStepVO = (id) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/fourthStepVO',
    method: 'get',
    params: {
      id
    }
  })
}

export const getFifthStepVO = (id) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/fifthStepVO',
    method: 'get',
    params: {
      id
    }
  })
}

export const getFifthFlow = (id) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/fifthFlow',
    method: 'post',
    params: {
      id
    }
  })
}

/* 变更归属服务商 */
export const updateBelongService = (row) => {
  return request({
    url: '/api/rb-service/service/posinfo/pos_info/updateBelongService',
    method: 'post',
    data: row
  })
}

/* 变更归属集团商户 */
export const updateBelongGroup = (row) => {
  return request({
    url: '/api/rb-service/service/posinfo/pos_info/updateBelongGroup',
    method: 'post',
    data: row
  })
}

/* 法人职位列表 */
export const getCrpProfession = (id) => {
  return request({
    url: `/api/rb-service/service/crpProfession/little/list/${id}`,
    method: 'get',
  })
}

/* 商户登记 新增 */
export const addPosIncoming = (row) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/addPosIncoming',
    method: 'post',
    data: row
  })
}

/* 商户登记 编辑 */
export const editPosIncoming = (row) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/editPosIncoming',
    method: 'post',
    data: row
  })
}

/* 商户登记 详情 */
export const getDetailPosIncoming = (rpiNo) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/detailPosIncoming',
    method: 'get',
    params: {
      rpiNo
    }
  })
}

/* 商户进件(聚合商户) 获取开户行名称 */
export const queryRpiBalanceAccName = (id, balanceAccType) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/queryRpiBalanceAccName',
    method: 'get',
    params: {
      id,
      balanceAccType
    }
  })
}
// 开户权限
export const openInfo = () => {
  return request({
    url: '/api/rb-service/service/serviceinfo/service_info/openInfo',
    method: 'get'
  })
}